import Vue from "vue";
import VueRouter from "vue-router";

//导入组件
import LoginModule from "@/components/Login.vue";
import Home from "@/views/Home.vue";
import NotFound from "@/components/NotFound.vue";
import PortList from "@/components/PortList.vue"
import K8sList from "@/components/K8sList.vue";
import AddressList from "@/components/AddressList.vue";
import ProjectList from "@/components/ProjectList.vue";
import ProjectDetails from "@/components/ProjectDetails.vue";
import K8sDetails from "@/components/K8sDetails.vue";
import VulnerabilityStaus from "@/components/vulnerability.vue";
import UserList from "@/user/userList.vue";
import UserRoles from "@/user/userRoles.vue";
import UserDetails from "@/user/user_details.vue";
import UserRoleDetails from "@/user/userRole_details.vue";
import AddPort from "@/components/AddPort.vue";
import IndexSearch from "@/components/index.vue";
import addresslist from "@/address/address.vue"

Vue.use(VueRouter)


const routes = [
    {
        path: '/',
        name: "index",
        component: IndexSearch,
        meta:{
            title: '首页 搜索 - FeiMaotui'
        }
    },
    {
        path: '/ui/list',
        name: "addresslist",
        component: addresslist,
        meta:{
            title: '地址列表  地址搜索 - FeiMaotui'
        }
    },

    {
        path: '/login',
        name: "LoginModule",
        component: LoginModule,
        meta:{
            title: '欢迎登录 - FeiMaotui'
        }
    },
    {
        path: '/dashboard',
        redirect: '/dashboard/addresslist',
        name: 'Home',
        component: Home,
        meta: {
            requiresAuth: true
        },
        children: [
            {
                path: 'addresslist',
                name:'地址列表',
                component: AddressList,
                meta: {
                    requiresAuth: true,
                    menuItem:'1-1',
                    title: '地址列表 - FeiMaotui'
                },
            },
            {
                path: 'portlist',
                name: "端口列表",
                component: PortList,
                meta: {
                    requiresAuth: true,
                    menuItem:'1-2',
                    title: '端口列表 - FeiMaotui'

                },
            },
            {
                path: 'portlist/create',
                name: "增加服务端口",
                component: AddPort,
                meta: {
                    requiresAuth: true,
                    menuItem:'1-2',
                    title: '创建端口 - FeiMaotui'

                },
            },
            {
                path: 'k8slist',
                name: "K8s集群",
                component: K8sList,
                meta: {
                    requiresAuth: true,
                    menuItem:'1-3',
                    title: 'K8S集群 - FeiMaotui'

                },
            },
            {
                path: 'k8slist/k8sdetails',
                name: "集群详情",
                component: K8sDetails,
                meta: {
                    requiresAuth: true,
                    menuItem:'1-3',
                    title: '集群详情 - FeiMaotui'

                },
            },
            {
                path: 'projectlist',
                name: "平台列表",
                component: ProjectList,
                meta: {
                    requiresAuth: true,
                    menuItem:'1-4',
                    title: '平台列表 - FeiMaotui'


                },
            },
            {
                path: 'projectlist/projectdetails',
                name: "平台详情",
                component: ProjectDetails,
                meta: {
                    requiresAuth: true,
                    menuItem:'1-4',
                    title: '平台详情 - FeiMaotui'

                },
            },
            {
                path: '/dashboard/projectlist/vulnerability',
                name: "漏洞修复详情",
                component: VulnerabilityStaus,
                meta: {
                    requiresAuth: true,
                    menuItem:'1-4',
                    title: '漏洞修复详情 - FeiMaotui'

                },
            },
            {
                path: '/dashboard/users',
                name: "用户列表",
                component: UserList,
                meta: {
                    requiresAuth: true,
                    menuItem:'2-1',
                    title: '用户列表 - FeiMaotui'

                },
            },
            {
                path: '/dashboard/users/roles',
                name: "角色列表",
                component: UserRoles,
                meta: {
                    requiresAuth: true,
                    menuItem:'2-2',
                    title: '角色列表 - FeiMaotui'

                },
            },
            {
                path: '/dashboard/users/details',
                name: "用户详情",
                component: UserDetails,
                meta: {
                    requiresAuth: true,
                    menuItem:'2-1',
                    title: '用户详情 - FeiMaotui'

                },
            },
            {
                path: '/dashboard/users/role/details',
                name: "角色详情",
                component: UserRoleDetails,
                meta: {
                    requiresAuth: true,
                    menuItem:'2-2',
                    title: '角色详情 - FeiMaotui'
                },
            },
        ]
    },
    {
        path: '*',
        component: NotFound,
        meta:{
            title: '404 - 页面未找到 - FeiMaotui'
        },
    }
];
const router = new VueRouter({
    mode: 'history',  // 使用 HTML5 history 模式，去掉 URL 中的 #
    routes
});




export default router;
